import request from '@/libs/request'

/**
 * 选课列表
 * @returns
 */
export const electiveList = data => {
  return request({
    url: `/elective/list`,
    method: 'post',
    data
  })
}

/**
 * 用户选课列表
 * @returns
 */
 export const electiveUserList = data => {
  return request({
    url: `/elective/user/list`,
    method: 'post',
    data
  })
}

/**
 * 选课详情
 * @returns
 */
export const electiveInfo = data => {
  return request({
    url: `/elective/${data.user_id}/${data.course_id}/info`,
    method: 'get'
  })
}

/**
 * 添加选课
 * @returns
 */
export const electiveAdd = data => {
  return request({
    url: `/elective/${data.course_id}/info`,
    method: 'post',
    data: data
  })
}

/**
 * 修改选课
 * @returns
 */
export const electiveEdit = data => {
  return request({
    url: `/elective/${data.user_id}/${data.course_id}/info`,
    method: 'put',
    data
  })
}

/**
 * 删除选课
 * @returns
 */
export const electiveDelete = data => {
  return request({
    url: `/elective/${data.user_id}/${data.course_id}/info`,
    method: 'delete'
  })
}
